﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:controls="clr-namespace:myCollections.Controls">

    <!--Metro Style-->
    <FontFamily x:Key="DefaultFont">Segoe UI</FontFamily>
    <System:Double x:Key="SmallTextSize">12</System:Double>
    <System:Double x:Key="NormalTextSize">14</System:Double>
    <System:Double x:Key="LargeTextSize">16</System:Double>

   

    <Geometry x:Key="PathMaximize">M9.1534417E-08,-3.4785184E-07 L15.000002,-3.4785184E-07 15.000002,15.000005 9.1534417E-08,15.000005 9.1534417E-08,-3.4785184E-07 z M1.4997003,4.5001214 L13.498802,4.5001214 13.498802,13.500065 1.4997003,13.500065 1.4997003,4.5001214 z</Geometry>
    <Geometry x:Key="PathRestore">M 132.018,70.0098L 139.019,70.0098L 139.019,77.0107L 132.018,77.0107L 132.018,70.0098 Z M 133.019,72.01L 138.019,72.01L 138.019,76.0106L 133.019,76.0106L 133.019,72.01 Z M 135.019,67.0094L 142.02,67.0094L 142.02,74.0103L 139.019,74.0103L 139.019,73.0102L 141.02,73.0102L 141.02,69.0096L 136.019,69.0096L 136.019,70.0098L 135.019,70.0098L 135.019,67.0094 Z</Geometry>
    <Geometry x:Key="PathClose">F1 M 171.964,69.0358L 169.982,67.0534L 166.988,70.047L 164.01,67.0694L 162.02,69.0599L 164.997,72.0375L 162.028,75.0071L 164.01,76.9895L 166.98,74.0199L 169.973,77.0135L 171.964,75.0231L 168.97,72.0294L 171.964,69.0358 Z</Geometry>

    <Style x:Key="MetroPathButton" TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Background="Transparent" Tag="{TemplateBinding Tag}">
                        <ContentPresenter x:Name="content" Tag="{TemplateBinding Tag}"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.6"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1.0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.4"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="content">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.2"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="BorderLessWindow" TargetType="{x:Type controls:BorderLessWindow}">
        <Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
        <Setter Property="FontSize" Value="{StaticResource NormalTextSize}" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="BorderBrush" Value="{DynamicResource ToolbarBackGroundColor}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="Icon" Value="/myCollections;component/Images/AppIcone.png" />
        <Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:BorderLessWindow}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}">
                        <AdornerDecorator>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="60"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter Margin="0,0,0,0" Grid.ColumnSpan="3"/>
                                <Rectangle x:Name="PART_HeaderPanel" Height="40" Width="300" Panel.ZIndex="0" Grid.Column="1"
                                      Fill="Transparent"  VerticalAlignment="Top" HorizontalAlignment="Right" Cursor="SizeAll"/>

                                <StackPanel HorizontalAlignment="Right" Margin="0,0,6,0" Orientation="Horizontal" 
                                                Height="40" VerticalAlignment="Top" Grid.Column="2">

                                    <StackPanel x:Name="PART_WindowControls" Orientation="Horizontal" VerticalAlignment="Top">
                                        <Button Focusable="False" x:Name="PART_MinimiseButton" Style="{DynamicResource MetroPathButton}" 
                                                Width="19" Height="23" ToolTip="Minimize" Command="{TemplateBinding MinimiseCommand}">
                                            <Rectangle Width="7" Height="2" Fill="{DynamicResource MetroHeadingColorDark}" VerticalAlignment="Bottom" Margin="0,0,0,4" />
                                        </Button>
                                        <Button Focusable="False"  x:Name="PART_MaximiseBtn" Style="{DynamicResource MetroPathButton}" Width="19" Height="23" ToolTip="Maximize" Command="{TemplateBinding MaximiseCommand}">
                                            <Path Fill="{DynamicResource MetroHeadingColorDark}" Data="{StaticResource PathMaximize}" Margin="0,0,0,0" Width="9" Height="9" Stretch="Fill" />
                                        </Button>
                                        <Button Focusable="False" x:Name="PART_RestoreBtn" Style="{DynamicResource MetroPathButton}" Width="19" Height="23" ToolTip="Restore" Visibility="Collapsed" Command="{TemplateBinding MaximiseCommand}">
                                            <Path Fill="{DynamicResource MetroHeadingColorDark}" Data="{StaticResource PathRestore}" Margin="0,0,0,0" Width="9" Height="9" Stretch="Fill" />
                                        </Button>
                                        <Button Focusable="False" x:Name="PART_CloseBtn" Width="19" Height="23" Style="{DynamicResource MetroPathButton}" ToolTip="Quit" Command="{TemplateBinding ExitCommand}">
                                            <Path Fill="{DynamicResource MetroHeadingColorDark}" Data="{StaticResource PathClose}" Margin="0,0,0,0" Stretch="Fill" Width="9" Height="9" />
                                        </Button>
                                        <Button Focusable="False" x:Name="PART_CloseBtnMax" Width="25" Height="23" Margin="0,0,-6,0" Style="{DynamicResource MetroPathButton}" ToolTip="Quit" Visibility="Collapsed" Command="{TemplateBinding ExitCommand}">
                                            <Path Fill="{DynamicResource MetroHeadingColorDark}" Data="{StaticResource PathClose}" Margin="0,0,6,0" Stretch="Fill" Width="9" Height="9" />
                                        </Button>

                                    </StackPanel>
                                </StackPanel>

                                <ResizeGrip x:Name="PART_FormResizeGrip" BorderBrush="{DynamicResource MetroHeadingColorDark}" 
                                            HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="Transparent" 
                                            Focusable="false" Cursor="SizeNWSE" Panel.ZIndex="5" Grid.ColumnSpan="3"/>
                                <Rectangle  x:Name="PART_LeftResizeRect"  HorizontalAlignment="Left" Margin="0,5" Width="5" Cursor="SizeWE" Panel.ZIndex="5" Fill="Transparent" />
                                <Rectangle  x:Name="PART_RightResizeRect"  HorizontalAlignment="Right" Width="5" Cursor="SizeWE" Panel.ZIndex="5" Margin="0,5,0,10" Fill="Transparent" />
                                <Rectangle  x:Name="PART_BottomResizeRect"   VerticalAlignment="Bottom" Height="5" Margin="5,0,10,0" Cursor="SizeNS" Panel.ZIndex="5" Fill="Transparent" />
                                <Rectangle  x:Name="PART_TopResizeRect" VerticalAlignment="Top" Height="5" Margin="5,0" Cursor="SizeNS" Panel.ZIndex="5" Fill="Transparent" />
                                <Rectangle  x:Name="PART_TopLeftResizeRect"  VerticalAlignment="Top" Height="5" Margin="0" Width="5" HorizontalAlignment="Left" Cursor="SizeNWSE" Panel.ZIndex="5" Fill="Transparent" />
                                <Rectangle  x:Name="PART_TopRightResizeRect"  VerticalAlignment="Top" Height="5" Margin="0" Width="5" HorizontalAlignment="Right" Cursor="SizeNESW" Panel.ZIndex="5" Fill="Transparent" />
                                <Rectangle  x:Name="PART_BottomLeftResizeRect"  VerticalAlignment="Bottom" Height="5" Margin="0" Width="5" HorizontalAlignment="Left" Cursor="SizeNESW" Panel.ZIndex="5" Fill="Transparent" />

                            </Grid>

                        </AdornerDecorator>
                    </Border>
                    <ControlTemplate.Triggers>
                        <EventTrigger RoutedEvent="Window.Loaded">
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.200" From="0"  To="1" Storyboard.TargetProperty="Opacity"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>